Merged
Conversation
Enables pushing to multiple remotes (e.g., GitHub + GitLab mirrors) by configuring multiple push URLs using multiline syntax, consistent with version-overrides and ignores patterns. Implementation: - config.py: Add parse_multiline_list() to parse multiline pushurl values - config.py: Detect and store multiple pushurls as list with backward compat - vcs/git.py: Update git_set_pushurl() to use --add flag for additional URLs - First pushurl set without --add, subsequent ones with --add Configuration example: ```ini [my-package] url = https://github.com/org/repo.git pushurl = git@github.com:org/repo.git git@gitlab.com:org/repo.git git@bitbucket.org:org/repo.git ``` Backward compatibility: - Single pushurl: Works unchanged (no pushurls list created) - Multiple pushurls: New multiline syntax (pushurls list created) - First pushurl stored in pushurl key for backward compat - Smart threading logic unchanged (checks for pushurl presence) Tests: - test_config_parse_multiple_pushurls: Config parsing validation - test_git_set_pushurl_multiple: Git command sequence verification - test_git_checkout_with_multiple_pushurls: End-to-end integration All 197 tests pass (194 existing + 3 new). All linting checks pass. Documentation updated in README.md and CHANGES.md.
3723e3b to
9af2804
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for Git's multiple push URL feature, enabling pushing to multiple remotes (e.g., GitHub + GitLab mirrors) automatically. Uses multiline configuration syntax consistent with
version-overridesandignores.Motivation
Users often need to mirror repositories across multiple Git hosting services (GitHub, GitLab, Bitbucket) for redundancy, CI/CD pipelines, or organizational requirements. Git natively supports multiple push URLs per remote, and mxdev should support this workflow.
Changes
Core Implementation
1. Configuration Parsing (config.py):
parse_multiline_list()function to parse multiline configuration valuespushurlslistpushurlkey for backward compatibility2. Git Operations (vcs/git.py):
git_set_pushurl()to handle both single and multiple pushurlsgit config remote.origin.pushurl URLgit config --add remote.origin.pushurl URL3. Tests (tests/test_config.py, tests/test_git_additional.py):
test_config_parse_multiple_pushurls(): Validates multiline parsing and backward compattest_git_set_pushurl_multiple(): Verifies git command sequence with --add flagtest_git_checkout_with_multiple_pushurls(): End-to-end integration testConfiguration Example
When you run
git pushin the checked-out repository, Git will push to all configured pushurls sequentially.Backward Compatibility ✅
Fully backward compatible:
pushurl = git@github.com:org/repo.git(unchanged behavior, nopushurlslist)pushurlslist)"pushurl" in sourcecontinues to workTesting
Documentation
Implementation Notes
Git Behavior:
git pushis runDesign Decisions:
version-overridesandignores"pushurl" in sourcefor any value)Related
Complements the smart threading enhancement from PR #69 - HTTPS URLs with any pushurl (single or multiple) are processed in parallel as they're assumed to be public/read-only.